﻿#pragma once

#include "qsyncobject.h"

namespace micro{

namespace core{



class QMutex : public QSyncObject
{
	//_NO_COPY( QMutex );
public:
	// Contruction.
	QMutex( BOOL bInitialHolder, LPCTSTR pszName = nullptr, LPSECURITY_ATTRIBUTES lpAttributes = nullptr ) 
	{
		// Create the handle.
		m_hHandle = ::CreateMutex( lpAttributes, bInitialHolder, pszName );
		ASSERT( m_hHandle );
	}

	// Destruction.
	virtual ~QMutex()
	{
	}

	// Lock the event handle.
	inline virtual bool Unlock() { ASSERT( m_hHandle ); return 0 != ::ReleaseMutex( m_hHandle ); }
	inline virtual bool Lock() { return false; }
};


 



}//core

}//micro